using System;
using Microsoft.SPOT;

public delegate void VISIEventHandler(object o, VISIEventArgs e);

public class VISIEventArgs : EventArgs
{
    public VISICommands Command;
    public VISIObjects Object;
    public int Index;
    public int Data;

    public VISIEventArgs(VISIReply reply)
    {
        Command = reply.Command;
        Object = reply.Object;
        Data = reply.Data;
        Index = reply.Index;
    }
}

public enum VISICommands
{
    READ_OBJ        = 0x00, // Object ID, Object Index
    WRITE_OBJ       = 0x01, // Object ID, Object Index, Value (msb), Value (lsb)
    WRITE_STR       = 0x02, // String Index, String Length, String (1byte chars)
    WRITE_STRU      = 0x03, // String Index, String Length, String (2byte chars)
    WRITE_CONTRAST  = 0x04, // Value
    REPORT_OBJ      = 0x05, // Object ID, Object Index, Value (msb), Value (lsb)
    REPORT_EVENT    = 0x07  // Object ID, Object Index, Value (msb), Value (lsb)
}

public enum VISIObjects
{
    DipSwitch       = 0x00, // IO
    Knob            = 0x01, // IO
    RockerSwitch    = 0x02, // IO
    RotarySwitch    = 0x03, // IO
    Slider          = 0x04, // IO
    TrackBar        = 0x05, // IO
    WinButton       = 0x06, // IO
    AngularMeter    = 0x07, // O
    CoolGauge       = 0x08, // O
    CustomDigits    = 0x09, // O
    Form            = 0x0A, // O (Used to set the current form)
    Gauge           = 0x0B, // O
    Image           = 0x0C, // (Displayed as part of form, no method to alter)
    Keyboard        = 0x0D, // I (Keyboard Inputs are always single bytes and are unsolicited)
    Led             = 0x0E, // O
    LedDigits       = 0x0F, // O
    Meter           = 0x10, // O
    Strings         = 0x11, // O
    Thermometer     = 0x12, // O
    UserLed         = 0x13, // O
    Video           = 0x14, // O
    StaticText      = 0x15, // (Displayed as part of form, no method to alter)
    Sound           = 0x16, // O
    Timer           = 0x17, // O
}

public struct VISIReply
{
  public VISICommands Command;
  public VISIObjects Object;
  public int Index;
  public int Data;
}